---
apiVersion: v1
kind: DeploymentConfig
metadata:
  labels:
    app: discourse2fedmsg
    service: discourse2fedmsg
  name: discourse2fedmsg
spec:
  replicas: 1
  selector:
    app: discourse2fedmsg
    deploymentconfig: discourse2fedmsg
  strategy:
    resources: {}
  template:
    metadata:
      labels:
        app: discourse2fedmsg
        deploymentconfig: discourse2fedmsg
    spec:
      containers:
      - image: discourse2fedmsg:latest
        name: discourse2fedmsg
        env:
        - name: APP_MODULE
          value: "deploy.wsgi"
        - name: FLASK_CONFIG
          value: "/etc/discourse2fedmsg/discourse2fedmsg.cfg"
        ports:
        - containerPort: 8080
          protocol: TCP
        volumeMounts:
        - name: discourse2fedmsg-config-volume
          mountPath: "/etc/discourse2fedmsg"
          readOnly: true
        - name: wsgi-script-volume
          mountPath: "/opt/app-root/src/deploy"
          readOnly: true
        - name: fedora-messaging-config-volume
          mountPath: "/etc/fedora-messaging"
          readOnly: true
        - name: fedora-messaging-ca-volume
          mountPath: /etc/pki/fedora-messaging/cacert.pem
          subPath: cacert.pem
          readOnly: true
        - name: fedora-messaging-crt-volume
          mountPath: /etc/pki/fedora-messaging/discourse2fedmsg-cert.pem
          subPath: discourse2fedmsg-cert.pem
          readOnly: true
        - name: fedora-messaging-key-volume
          mountPath: /etc/pki/fedora-messaging/discourse2fedmsg-key.pem
          subPath: discourse2fedmsg-key.pem
          readOnly: true
        readinessProbe:
          timeoutSeconds: 10
          initialDelaySeconds: 5
          periodSeconds: 60
          httpGet:
            path: "/healthz/ready"
            port: 8080
        livenessProbe:
          timeoutSeconds: 10
          initialDelaySeconds: 3
          periodSeconds: 60
          httpGet:
            path: "/healthz/live"
            port: 8080
      volumes:
      - name: discourse2fedmsg-config-volume
        configMap:
          name: discourse2fedmsg-config
      - name: wsgi-script-volume
        configMap:
          name: wsgi-script
      - name: fedora-messaging-config-volume
        configMap:
          name: fedora-messaging-config
      - name: fedora-messaging-ca-volume
        secret:
          secretName: fedora-messaging-ca
      - name: fedora-messaging-crt-volume
        secret:
          secretName: fedora-messaging-crt
      - name: fedora-messaging-key-volume
        secret:
          secretName: fedora-messaging-key

  triggers:
  - type: ConfigChange
  - type: ImageChange
    imageChangeParams:
      automatic: true
      containerNames:
      - discourse2fedmsg
      from:
        kind: ImageStreamTag
        name: discourse2fedmsg:latest
